//
//  NetRequestClass.m
//  ReactiveCocoa
//
//  Created by 李松 on 2017/12/2.
//  Copyright © 2017年 lisong. All rights reserved.
//

#import "NetRequestClass.h"
#import <AFNetworking/AFNetworking.h>


@implementation NetRequestClass

+ (void)NetRequestPostWithRequestURLString:(NSString *)requestURLString WithParameter:(NSDictionary *)parameter WithSucceedBlock:(SucceedBlock)succeedBlock WithErrorBlock:(ErrorBlock)errorBlock{
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    [manager POST:requestURLString parameters:parameter progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        succeedBlock(responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        errorBlock([error description]);
    }];
    
    
    
}

+ (void)NetRequestGetWithRequestURLString:(NSString *)requestURLString WithParameter:(NSDictionary *)parameter WithSucceedBlock:(SucceedBlock)succeedBlock WithErrorBlock:(ErrorBlock)errorBlock{
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    [manager GET:requestURLString parameters:parameter progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        succeedBlock(responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        errorBlock([error description]);
    }];
    
}

@end
